/*
 * Lucas McDaniel
 * GSoC '11
 * HoneyViz
 * 
 * This basic class utilizes ColorIcon.java to set the 
 * variable color next to the event name or location name
 */

import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

public class IconRenderer implements ListCellRenderer {
    
    protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
    
    public IconRenderer()
    {}
    
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean focus)
    {
        JLabel item = (JLabel)defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, focus);
        item.setIcon(new ColorIcon((EventColorManager.getTempEvent(item.getText()).paint)));
        return item;
    }
    
}
